package java_thinking.unit_18_IO._18_10;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

/**
 * @Desc:   使用Transfer相连数据通道,虽然不是很经常做这样的事情
 * @author: cww
 * @DateTime: 2019/5/17 8:58
 */

public class TransferTo {
    private static String file = "src/maindemo/java/java_thinking/unit_18_IO/_18_10/GetChannel.txt";
    private static String file1 = "src/maindemo/java/java_thinking/unit_18_IO/_18_10/GetChannelTransfer1.txt";
    public static void main(String[] args) throws IOException {
        FileChannel in = new FileInputStream(file).getChannel(),
                out = new FileOutputStream(file1).getChannel();
        in.transferTo(0,in.size(), out);
    }
}
